<template>
  <div class="child">
      <h2>子组件1</h2>
      <h3>玩具：{{ toy }}</h3>
      <button @click="sendToyToChild2">发送玩具给子组件2</button>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import emitter from '@/utils/emitter'
const toy = ref('变形金刚')

function sendToyToChild2() {
    emitter.emit('get-toy', toy.value)
}
</script>

<style scoped>
.child {
  padding: 10px;
  box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1);
  background-color: skyblue;
  border-radius: 10px;
}
</style>